package com.ossean.projectmanager.lasttabledao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface PointersDao {
	
	//读取pointers表中对应sourceTableName和targetTableNamed的指针
	@Select("select Pointer from pointers where SourceTableName=#{source} and TargetTableName=#{target}")
	public int readPointer(@Param("source") String source, @Param("target") String target);
	
	//初始化指针 初始化大小为1
	@Insert("insert into pointers (SourceTableName, TargetTableName, Pointer) values (#{source}, #{target}, 1)")
	public void insertPointer(@Param("source") String source, @Param("target") String target);
	
	
	//更新指针
	@Update("update pointers set Pointer=#{pointer} where SourceTableName=#{source} and TargetTableName=#{target}")
	public void updatePointer(@Param("source") String source, @Param("target") String target, @Param("pointer") int pointer);

}
